if (SERVER) then
	AddCSLuaFile("shared.lua")
	SWEP.Weight				= 5
	SWEP.AutoSwitchTo		= false
	SWEP.AutoSwitchFrom		= false
end

if (CLIENT) then
	SWEP.PrintName			= "Wood Hatchet"
	SWEP.DrawAmmo			= false
	SWEP.DrawCrosshair		= true
	SWEP.ViewModelFOV		= 55
	SWEP.ViewModelFlip		= false
	SWEP.CSMuzzleFlashes	= false
	SWEP.Slot = 2
	SWEP.SlotPos		= 1
end



SWEP.Author			= ""
SWEP.Contact		= ""
SWEP.Purpose		= "Effective woodcutting tool."
SWEP.Instructions	= "Primary fire: Chop wood from a tree."


SWEP.Spawnable			= false
SWEP.AdminSpawnable		= false

SWEP.ViewModel			= "models/weapons/v_copper_hatchet.mdl"
SWEP.WorldModel			= "models/weapons/w_copper_hatchet.mdl"

SWEP.Primary.ClipSize		= -1
SWEP.Primary.DefaultClip	= -1
SWEP.Primary.Automatic		= true
SWEP.Primary.Ammo			= "none"

SWEP.Secondary.ClipSize		= -1
SWEP.Secondary.DefaultClip	= -1
SWEP.Secondary.Automatic	= false
SWEP.Secondary.Ammo			= "none"

/*---------------------------------------------------------
	PrimaryAttack
---------------------------------------------------------*/
function SWEP:PrimaryAttack()
	if CLIENT then return end

	local tr = util.TraceLine({
		start = self.Owner:GetShootPos(),
		endpos = (self.Owner:GetShootPos() + (self.Owner:GetAimVector() * 150)),
		filter = self.Owner
	})

	if !tr.HitNonWorld or !tr.Entity then return end

	if tr.Entity:IsTree() then
		self.Weapon:SetNextPrimaryFire(CurTime() + 0.3)
		self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER)

		local effectdata = EffectData()
                effectdata:SetOrigin( self.Owner:GetPos() )
                effectdata:SetStart( tr.HitPos )
        util.Effect( "Impact", effectdata )

		local wood = math.random(1, 6) * (self.Owner:GetSkill("Lumbering") + 1)

		tr.Entity:TakeDamage( wood, self.Owner, self.Weapon )

		--self.Owner:Process( "WoodCutting", 0.29, data)
	end
end